home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.382 < prev    next >
Encoding:
Text File  |  1996-02-12  |  27.6 KB  |  705 lines

  1. Frequently Asked Questions (FAQS);faqs.382
  2.  
  3.  
  4.  
  5.  
  6. -----------------------------------------------------------------------------
  7. Subject: 108)  The OpenWindows server hangs when I popup a menu with Button 3.
  8. [Last modified: August 92]
  9.  
  10. Answer: This is an OpenWindows problem, but if you have Motif source you can
  11. fix your own applications. From Steve Sistare of Thinking Machines Corp.:
  12. "Change the 2 calls to XtGrabButton in RowColumn.c such that ButtonReleaseMask
  13. | ButtonPressMask is passed for the event mask.  Currently, only
  14. ButtonReleaseMask is passed.  Also, change the owner_event argument to FALSE.
  15. " This has not been fixed in Motif as at 1.1.5.
  16.  
  17. -----------------------------------------------------------------------------
  18. Subject: 109) Has anyone made shared libraries on an IBM RS/6000?
  19.  
  20. Answer: From Sakari Jalovaara: There is a problem: Xm redefines VendorShell
  21. and the AIX linker put _both_ Xm's and Xt's VendorShell into programs.  When
  22. an AIX shared library is created as many references inside the library are
  23. resolved as possible.  If the symbol vendorShellClassRec is defined in libXt
  24. and referenced, say, from a function XtFoo() also in libXt, the "ld" run that
  25. creates the shared library resolves the reference:
  26.  
  27.         XtFoo() -> vendorShellClassRec
  28.  
  29. Then I create the Motif library that has its own vendorShellClassRec and an
  30. XmBar() function that uses it; libXm will also contain a resolved reference to
  31. vendorShellClassRec:
  32.  
  33.         XmBar() -> vendorShellClassRec
  34.  
  35. Finally, I link a program that uses both XtFoo() and XmBar() and the program
  36. will end up with _two_ independent "vendorShellClassRec"s:
  37.  
  38.         XtFoo() -> vendorShellClassRec [Xt version]
  39.         XmBar() -> vendorShellClassRec [Xm version]
  40.  
  41. Instant schizo zaphod mode.  In reality, vendorShellClassRec is not referenced
  42. from functions but from other widget class records.
  43.  
  44. I can't just pull Vendor.o out from the shared Xt (Vendor.o appears to define
  45. the only external symbols redefined by libXm) because AIX shared libraries
  46. apparently can't contain unresolved external references.  If I take out
  47. Vendor.o I have to take out every other file that uses symbols defined there -
  48. and then files that need those files, etc.  I tried it and ended up with three
  49. or four object files in libXt and the res non-sharable.
  50.  
  51. I kludged around this by putting all of libXt (minus Vendor.o) into the shared
  52. libXm.  It isn't a pretty solution but it works - and beats having a
  53. statically linked two-megabyte "periodic" demo...
  54.  
  55.  
  56. -----------------------------------------------------------------------------
  57. Subject: 110)  What is the error  "Unaligned access in XmString" under Ultrix?
  58.  
  59. Answer: Compile  XmString.c with STRINGS_ALIGNED.
  60.  
  61. -----------------------------------------------------------------------------
  62. Subject: 111) TOPIC: KEYSYMS
  63.  
  64. -----------------------------------------------------------------------------
  65. Subject: 112)  What is causing the messages "unknown keysym osfDown..."?  It
  66. happens when I run an application under Motif 1.1
  67.  
  68. Answer: There is an OSF supplied addition to the /usr/lib/X11/XKeysymDB file.
  69. It is found on the release tape and should have been automatically installed
  70. if the installation procedure was followed in the Release Notes.
  71.  
  72. You have to copy (or append) lib/Xm/XKeysymDB into /usr/lib/X11.  This may
  73. require root permission.  It is not clear how to fix the problem if you can't
  74. do this.  The error comes from Xt translation table parsing and can't be fixed
  75. in Motif, so if you can't get root permission you may be stuck.  The file is
  76. not copyrighted so you can install it on other systems.
  77.  
  78. If X has been built so that XKeysymDB is not in this directory, and you don't
  79. know where it is looking, run 'strings libX11.a | grep XKeysymDB' to find the
  80. path.
  81.  
  82. On a Sun running openwin with shared libraries, you may need to put the path
  83. for the library containing XKeysymDB *first* in the path list in
  84. LD_LIBRARY_PATH, or it may find the wrong XKeysymDB in the wrong directory.
  85.  
  86. XKeysymDB simply contains the registered keysym values for the OSF keysyms.
  87. The OSF values are server-independent.  And, all registered keysyms will be
  88. included in an XKeysymDB file to be shipped with X11R5.
  89.  
  90. In the meantime (till all systems are X11R5+), a list of the registered
  91. keysyms can be found in the X11R4 release in mit/doc/Registry/Xregistry.
  92.  
  93.  
  94.  
  95. -----------------------------------------------------------------------------
  96. Subject: 113) What happens if I can't install Motif Keysyms?
  97.  
  98. From: tessi!george@nosun.West.Sun.COM (George Mitchell)
  99.  
  100. Here's what appears to happen if you don't have XKeysymDB in place to define
  101. OSF's virtual keysyms:
  102.  
  103. 1. At class initialize time, for a widget (such as XmText) that uses virtual
  104. keysyms in its event translation table, all entries which refer to those
  105. keysyms fail to parse correctly.  In the case of XmText, instead of ending up
  106. with a translation table with roughly 90 entries, you end up with one that has
  107. 29.
  108.  
  109. 2. XKeysymDB doesn't exist, so you'd assume that KeyPress events will get
  110. translated to plain vanilla keysyms, right?  WRONG!  All Motif widgets install
  111. a virtual keysym translator ANYWAY!  Consequently, the backspace key (for
  112. example) gets translated to the keysym osfBackSpace.
  113.  
  114. 3. Therefore, if you augment or override your widget's translations with
  115. translations that refer to plain vanilla BackSpace, they will never be
  116. triggered, because you will NEVER see plain vanilla BackSpace, only
  117. osfBackSpace.
  118.  
  119. 4. But you can't use osfBackSpace in an event translation entry, because you
  120. don't have XKeysymDB installed!
  121.  
  122. Here's how I'm "dealing" with the problem right now: Motif installs its
  123. virtual keysym translator by calling XtSetKeyTranslator every time a
  124. VendorShell (or subclass) widget is created.  So every time I create a shell,
  125. I immediately call XtSetKeyTranslator (display, XtTranslateKey) to restore the
  126. default translator.  No more funny virtual keysyms!  Now I can reinstall non-
  127. osfKeySym translations and have them work the way I expect.
  128.  
  129.  
  130. -----------------------------------------------------------------------------
  131. Subject: 114) Why has OSF introduced Keysyms into Motif 1.1?  They weren't
  132. there in Motif 1.0.
  133.  
  134. Answer: From: ellis@osf.org
  135.  
  136. Virtual Keysyms are meant to provide a consistent keyboard model for Motif
  137. applications running in a heterogeneous environment in which proprietary (i.e.
  138. vendor specific) non-Motif applications may also be running.
  139.  
  140. First of all, for the sake of the rest of the readers, let's explain why this
  141. is an issue:
  142.  
  143. It would be lovely if Motif's translation tables could just use the obvious
  144. keysyms predefined by X.  For example, there are keysyms for XK_BackSpace,
  145. XK_Delete, XK_Left, XK_Right, etc.  Shouldn't these be the ones that are used
  146. in our translations?  Unfortunately, the problem is not so simple.  Some
  147. specific examples:
  148.  
  149.    While most vendors bind XK_BackSpace to the key at the top right
  150.    of the standard keyboard (often engraved with a leftwards
  151.    pointing arrow), not all do.  In fact, some vendors (including DEC)
  152.    bind that key to XK_Delete.
  153.  
  154.    While most vendors bind the arrow keys to XK_Up, etc, a number of
  155.    vendors (including Sun, on some servers) bind them to function key
  156.    keysyms.
  157.  
  158. A simplistic solution would require the use of xmodmap to change the offending
  159. bindings.  That would work swell in an all Motif environment.  However, OSF's
  160. goal (not always perfectly achieved) is interoperability.  That is, we'd like
  161. to make sure that both Motif and non-Motif programs can happily run in the
  162. same environment.
  163.  
  164. It is expected that a vendor may have a wide variety of existing X-based
  165. software that uses the keysyms as established by that vendor for specific
  166. purposes.  It is expected that these applications may run at the same time as
  167. Motif-based software.  Using xmodmap to change keysyms on the server side
  168. could "break" the existing applications (or at the very least their
  169. documentation) by making some keys unavailable, or by moving the location.
  170.  
  171. So, we chose not to use xmodmap.  By the way, though OpenLook uses a different
  172. implementation (they recompile their virtual translation tables into actual
  173. translation tables), they basically adopted the same approach, presumably for
  174. similar reasons.
  175.  
  176. To work properly, the virtual keysym model we implemented depends on Xlib
  177. finding XKeysymDB installed appropriately (which standard Motif installation
  178. does).  This simply defines the keysyms (not the key they are bound to).  This
  179. unfortunate piece of stupidity is necessary because MIT only includes standard
  180. keysyms in keysymdef.h.  It should be said that our lives would be made easier
  181. if MIT would also see fit to include registered keysyms in keysymdef.h as
  182. well.
  183.  
  184. Motif applications determine how to bind virtual to actual keys by looking for
  185. either a resource or a property on the root window which describes what to do.
  186. Note that this information is on the server side, so that all applications use
  187. the same virtual bindings regardless of where they are running.  Mwm will
  188. happily create the property if it finds a .motifbind file in your home
  189. directory when it starts up.  (Actually, things generally work even if none of
  190. this is done, since if all else fails, the Motif toolkit chooses a virtual
  191. bindings table to use based on the identification of the server).
  192.  
  193. The actual implementation of virtual keys is made possible by a hook in the
  194. Intrinsics.  Undoubtably, the implementation would be simpler and cleaner if
  195. virtual key support was more directly supported by the Intrinsics.  We will be
  196. exploring this possibility in the future.
  197.  
  198.   -- Ellis
  199.  
  200. -----------------------------------------------------------------------------
  201. Subject: 115) TOPIC: ICONS
  202.  
  203. Iconification/de-iconification is a co-operative process between a client and
  204. a window manager.  The relevant standards are set by ICCCM.  Mwm is ICCCM
  205. compliant.  The toplevel (non-override-redirect) windows of an application may
  206. be in three states: WithdrawnState (neither the window nor icon visible),
  207. NormalState (the window visible) or IconicState (the icon window or pixmap
  208. visible).  This information is contained in the WM_STATE property but ordinary
  209. clients are not supposed to look at that (its values have not yet been
  210. standardised).  Movement between the three states is standardised by ICCCM.
  211.  
  212. -----------------------------------------------------------------------------
  213. Subject: 116) How can I keep track of changes to iconic/normal window state?
  214.  
  215. Answer: You can look at the WM_STATE property, but this breaks ICCCM
  216. guidelines.  ICCCM compliant window managers will map windows in changing them
  217. to normal state and unmap them in changing them to iconic state. Look for
  218. StructureNotify events and check the event type:
  219.  
  220.         XtAddEventHandler (toplevel_widget,
  221.                         StructureNotifyMask,
  222.                         False,
  223.                         StateWatcher,
  224.                         (Opaque) NULL);
  225.         ....
  226.         void StateWatcher (w, unused, event)
  227.         Widget w;
  228.         caddr_t unused;
  229.         XEvent *event;
  230.         {
  231.                 if (event->type == MapNotify)
  232.                         printf ("normal\n");
  233.                 else if (event->type == UnmapNotify)
  234.                         printf ("iconified\n");
  235.                 else    printf ("other event\n");
  236.         }
  237.  
  238.  
  239. If you insist on looking at WM_STATE, here is some code (from Ken Sall) to do
  240. it:
  241.  
  242.         /*
  243.         ------------------------------------------------------------------
  244.         Try a function such as CheckWinMgrState below which returns one of
  245.         IconicState | NormalState | WithdrawnState | NULL :
  246.         ------------------------------------------------------------------
  247.         */
  248.         #define WM_STATE_ELEMENTS 1
  249.  
  250.         unsigned long *CheckWinMgrState (dpy, window)
  251.         Display *dpy;
  252.         Window window;
  253.         {
  254.           unsigned long *property = NULL;
  255.           unsigned long nitems;
  256.           unsigned long leftover;
  257.           Atom xa_WM_STATE, actual_type;
  258.           int actual_format;
  259.           int status;
  260.  
  261.             xa_WM_STATE = XInternAtom (dpy, "WM_STATE", False);
  262.  
  263.             status = XGetWindowProperty (dpy, window,
  264.                           xa_WM_STATE, 0L, WM_STATE_ELEMENTS,
  265.                           False, xa_WM_STATE, &actual_type, &actual_format,
  266.                           &nitems, &leftover, (unsigned char **)&property);
  267.  
  268.             if ( ! ((status == Success) &&
  269.                         (actual_type == xa_WM_STATE) &&
  270.                         (nitems == WM_STATE_ELEMENTS)))
  271.                 {
  272.                 if (property)
  273.                     {
  274.                     XFree ((char *)property);
  275.                     property = NULL;
  276.                     }
  277.                 }
  278.             return (property);
  279.         } /* end CheckWinMgrState */
  280.  
  281.  
  282. -----------------------------------------------------------------------------
  283. Subject: 117) How can I check if my application has come up iconic?  I want to
  284. delay initialisation code and other processing.
  285.  
  286. Answer: Use XtGetValues and check for the XmNinitialState value of the
  287. toplevel shell just before XtMainLoop. -- IconicState is iconic, NormalState
  288. is not iconic.
  289.  
  290.  
  291.  
  292.  
  293. -----------------------------------------------------------------------------
  294. Subject: 118) How can I start my application in iconic state?
  295.  
  296. Answer: From the command line
  297.  
  298.         application -iconic
  299.  
  300. Using the resource mechanism, set the resource XmNinitialState to IconicState
  301. of the toplevel shell widget (the one returned from XtInitialise).
  302.  
  303. -----------------------------------------------------------------------------
  304. Subject: 119) How can an application iconify itself?
  305.  
  306. Answer: In R4 and later, use the call XIconifyWindow.
  307.  
  308. For R3, send an event to the root window with a type of WM_CHANGE_STATE and
  309. data IconicState.
  310.  
  311.         void
  312.         IconifyMe (dpy, win)
  313.         Display *dpy;
  314.         Window win;     /* toplevel window to iconify */
  315.         {
  316.                 Atom xa_WM_CHANGE_STATE;
  317.                 XClientMessageEvent ev;
  318.  
  319.                 xa_WM_CHANGE_STATE = XInternAtom (dpy,
  320.                                         "WM_CHANGE_STATE", False);
  321.  
  322.                 ev.type = ClientMessage;
  323.                 ev.display = dpy;
  324.                 ev.message_type = xa_WM_CHANGE_STATE;
  325.                 ev.format = 32;
  326.                 ev.data.l[0] = IconicState;
  327.                 ev.window = win;
  328.  
  329.                 XSendEvent (dpy,
  330.                         RootWindow (dpy, DefaultScreen(dpy)),
  331.                         True,
  332.                         (SubstructureRedirectMask | SubstructureNotifyMask),
  333.                         &ev);
  334.                 XFlush (dpy);
  335.         }
  336.  
  337.  
  338. -----------------------------------------------------------------------------
  339. Subject: 120) How can an application de-iconify itself?
  340.  
  341. Answer: XMapWindow (XtDisplay (toplevel_widget), XtWindow (toplevel_widget)).
  342.  
  343. -----------------------------------------------------------------------------
  344. END OF PART FOUR
  345. --
  346. +----------------------+---+
  347.   Jan Newmarch, Information Science and Engineering,
  348.   University of Canberra, PO Box 1, Belconnen, Act 2616
  349.   Australia. Tel: (Aust) 6-2012422. Fax: (Aust) 6-2015041
  350. Xref: bloom-picayune.mit.edu comp.windows.x.motif:13661 news.answers:4512
  351. Newsgroups: comp.windows.x.motif,news.answers
  352. Path: bloom-picayune.mit.edu!enterpoop.mit.edu!news.media.mit.edu!micro-heart-of-gold.mit.edu!wupost!uunet!munnari.oz.au!manuel.anu.edu.au!csc.canberra.edu.au!news
  353. From: jan@ise.canberra.edu.au (Jan Newmarch)
  354. Subject: Motif FAQ (Part 5 of 5)
  355. Message-ID: <1992Dec10.001649.10616@csc.canberra.edu.au>
  356. Followup-To: comp.windows.x.motif
  357. Keywords: FAQ question answer
  358. Sender: news@csc.canberra.edu.au
  359. Reply-To: jan@ise.canberra.edu.au (Jan Newmarch)
  360. Organization: University of Canberra
  361. Date: Thu, 10 Dec 92 00:16:49 GMT
  362. Approved: news-answers-request@MIT.Edu
  363. Expires: +1 months
  364. Lines: 1847
  365.  
  366. Archive-name: motif-faq/part5
  367. Last-modified: Thu December 12 1992
  368. Version: 2.12
  369.  
  370.  
  371.  
  372. -----------------------------------------------------------------------------
  373. Subject: 121) TOPIC: MISCELLANEOUS
  374.  
  375. -----------------------------------------------------------------------------
  376. Subject: 122)+ What is the matter with Frame in Motif 1.2?
  377.  
  378. [Last modified: November 92]
  379.  
  380. Answer: This announcement has been made by OSF:
  381.  
  382. "IMPORTANT NOTICE
  383.  
  384. We have discovered two problems in the new 1.2 child alignment resources in
  385. XmFrame. Because some vendors may have committed, or are soon to commit to
  386. field releases of Motif 1.2 and 1.2.1, OSF's options for fixing them are
  387. limited. We are trying to deal with these in a way that does not cause
  388. hardship for application developers who will develop applications against
  389. various point versions of Motif. OSF's future actions for correction are
  390. summarized.
  391.  
  392. WHAT YOU SHOULD DO AND KNOW
  393.  
  394. 1. Mark the following change in your documentation.
  395.  
  396. On page 1-512 of the OSF/Motif Programmer's Reference, change the descriptions
  397. under XmNchildVerticalAlignment as follows (what follows is the CORRECT
  398. wording to match the current implementation):
  399.  
  400. XmALIGNMENT_WIDGET_TOP
  401.         Causes the BOTTOM edge of the title area to align
  402.         vertically with the top shadow of the Frame.
  403.  
  404. XmALIGNMENT_WIDGET_BOTTOM
  405.         Causes the TOP edge of the title area to align
  406.         vertically with the top shadow of the Frame.
  407.  
  408. 2. Note the following limitation on resource converters for Motif 1.2 and
  409. 1.2.1 implementations.
  410.  
  411. The rep types for XmFrame's XmNentryVerticalAlignment resource were
  412. incorrected implemented, which means that converters will not work properly.
  413. The following resource settings will not work from a resource file in 1.2 and
  414. 1.2.1:
  415.  
  416.         *childVerticalAlignment: alignment_baseline_bottom
  417.         *childVerticalAlignment: alignment_baseline_top
  418.         *childVerticalAlignment: alignment_widget_bottom
  419.         *childVerticalAlignment: alignment_widget_top
  420.  
  421. If you wish to set these values for these resources (note they are new
  422. constraint resources in XmFrame) you will have to set them directly in C or
  423. via uil.
  424.  
  425. WHAT WE WILL DO
  426.  
  427. The problem described in note #1 above will not be fixed in the OSF/Motif
  428. implementation until the next MAJOR release of Motif.  At that time we will
  429. correct the documentation and modify the code to match those new descriptions,
  430. but we will preserve the existing enumerated values and their behavior for
  431. backward compatibility for that release.
  432.  
  433. The fix for the problem described in note #2 will be shipped by OSF in Motif
  434. 1.2.2.
  435.  
  436. SUMMARY
  437. We are sorry for any difficulty this causes Motif users.  If you have any
  438. questions or flames (I suppose I deserve it) please send them directly to me.
  439. We sincerely hope this proactive response is better for our customers than you
  440. having to figure it out yourselves!
  441.  
  442. Libby
  443.  
  444.  
  445. -----------------------------------------------------------------------------
  446. Subject: 123)  What is IMUG and how do I join it?
  447.  
  448. Answer: IMUG is the International Motif User Group founded by Quest Windows
  449. Corporation and co-sponsored by FedUNIX.  IMUG is a non-profit organization
  450. working to keep users informed on technical and standards issues, to
  451. strengthen user groups on a local level, to increase communication among users
  452. internationally, and to promote the use of an international conference as a
  453. forum for sharing and learning more about Motif.  You can join it by
  454.  
  455.  1.  Pay the annual membership fee of $20 USD directly to IMUG.  Contact
  456.  
  457.      IMUG
  458.      5200 Great America Parkway
  459.      Santa Clara,  CA  95054
  460.      (408) 496-1900
  461.      imug@quest.com
  462.  
  463.  2.  Register at the International Motif User Conference, and automatically
  464.      become an IMUG member.
  465.  
  466.  3.  Donate a pd widget, widget tool or widget builder to the IMUG Widget
  467.      Depository and receive a free one year IMUG membership.
  468.  
  469.  
  470.  
  471. -----------------------------------------------------------------------------
  472. Subject: 124)  How do I set the title of a top level window?
  473. [Last modified: September 92]
  474.  
  475. Answer: Set XmNtitle (and optionally XmNtitleEncoding) for TopLevelShells.
  476. (Note that this is of type String rather than XmStrin.) Ypu can also set
  477. XmNiconName if you want its icon to show this title.  For XmDialogShells, set
  478. the XmNdialogTitle of its immediate child, assuming it's a BulletinBoard
  479. subclass.  These can also be set in resource files.
  480.  
  481.  
  482. -----------------------------------------------------------------------------
  483. Subject: 125)  Can I use editres with Motif?
  484. [Last modified: August 92]
  485.  
  486. Answer: It isn't built in to Motif (at 1.2.0), but you can do this in your
  487. application
  488.  
  489.     extern void _XEditResCheckMessages();
  490.     ...
  491.     XtAddEventHandler(shell_widget, (EventMask)0, True,
  492.                         _XEditResCheckMessages, NULL);
  493.  
  494. once for each shell widget that you want to react to the "click to select
  495. client" protocol.  Then link your client with the R5 libXmu.
  496.  
  497. David Brooks, OSF
  498.  
  499.  
  500. -----------------------------------------------------------------------------
  501. Subject: 126)  How can I put decorations on transient windows using olwm?
  502.  
  503. Answer: From Jean-Philippe Martin-Flatin <syj@ecmwf.co.uk>
  504.  
  505. /**********************************************************************
  506. ** WindowDecorations.c
  507. **
  508. ** Manages window decorations under the OpenLook window manager (OLWM).
  509. **
  510. ** Adapted from a C++ program posted to comp.windows.x.motif by:
  511. **
  512. **    +--------------------------------------------------------------+
  513. **    | Ron Edmark                          User Interface Group     |
  514. **    | Tel:        (408) 980-1500 x282     Integrated Systems, Inc. |
  515. **    | Internet:   edmark@isi.com          3260 Jay St.             |
  516. **    | Voice mail: (408) 980-1590 x282     Santa Clara, CA 95054    |
  517. **    +--------------------------------------------------------------+
  518. ***********************************************************************/
  519.  
  520. #include <X11/X.h>
  521. #include <X11/Xlib.h>
  522. #include <X11/Xatom.h>
  523. #include <X11/Intrinsic.h>
  524. #include <X11/StringDefs.h>
  525. #include <X11/Protocols.h>
  526. #include <Xm/Xm.h>
  527. #include <Xm/AtomMgr.h>
  528.  
  529. /*
  530. ** Decorations for OpenLook:
  531. ** The caller can OR different mask options to change the frame decoration.
  532. */
  533. #define OLWM_Header     (long)(1<<0)
  534. #define OLWM_Resize     (long)(1<<1)
  535. #define OLWM_Close      (long)(1<<2)
  536.  
  537. /*
  538. ** Prototypes
  539. */
  540. static void InstallOLWMAtoms  (Widget w);
  541. static void AddOLWMDialogFrame(Widget widget, long decorationMask);
  542.  
  543.  
  544. /*
  545. ** Global variables
  546. */
  547. static Atom AtomWinAttr;
  548. static Atom AtomWTOther;
  549. static Atom AtomDecor;
  550. static Atom AtomResize;
  551. static Atom AtomHeader;
  552. static Atom AtomClose;
  553. static int  not_installed_yet = TRUE;
  554.  
  555.  
  556. static void InstallOLWMAtoms(Widget w)
  557. {
  558.         AtomWinAttr = XInternAtom(XtDisplay(w), "_OL_WIN_ATTR" ,    FALSE);
  559.         AtomWTOther = XInternAtom(XtDisplay(w), "_OL_WT_OTHER",     FALSE);
  560.         AtomDecor   = XInternAtom(XtDisplay(w), "_OL_DECOR_ADD",    FALSE);
  561.         AtomResize  = XInternAtom(XtDisplay(w), "_OL_DECOR_RESIZE", FALSE);
  562.         AtomHeader  = XInternAtom(XtDisplay(w), "_OL_DECOR_HEADER", FALSE);
  563.         AtomClose   = XInternAtom(XtDisplay(w), "_OL_DECOR_CLOSE",  FALSE);
  564.  
  565.         not_installed_yet = FALSE;
  566. }
  567.  
  568. static void AddOLWMDialogFrame(Widget widget, long decorationMask)
  569. {
  570.         Atom   winAttrs[2];
  571.         Atom   winDecor[3];
  572.         Widget shell = widget;
  573.         Window win;
  574.         int    numberOfDecorations = 0;
  575.  
  576.         /*
  577.         ** Make sure atoms for OpenLook are installed only once
  578.         */
  579.         if (not_installed_yet) InstallOLWMAtoms(widget);
  580.  
  581.         while (!XtIsShell(shell)) shell = XtParent(shell);
  582.  
  583.         win = XtWindow(shell);
  584.  
  585.         /*
  586.         ** Tell Open Look that our window is not one of the standard OLWM window        ** types. See OLIT Widget Set Programmer's Guide pp.70-73.
  587.         */
  588.  
  589.         winAttrs[0] = AtomWTOther;
  590.  
  591.         XChangeProperty(XtDisplay(shell),
  592.                         win,
  593.                         AtomWinAttr,
  594.                         XA_ATOM,
  595.                         32,
  596.                         PropModeReplace,
  597.                         (unsigned char*)winAttrs,
  598.                         1);
  599.  
  600.         /*
  601.         ** Tell Open Look to add some decorations to our window
  602.         */
  603.         numberOfDecorations = 0;
  604.         if (decorationMask & OLWM_Header)
  605.                 winDecor[numberOfDecorations++] = AtomHeader;
  606.         if (decorationMask & OLWM_Resize)
  607.                 winDecor[numberOfDecorations++] = AtomResize;
  608.         if (decorationMask & OLWM_Close)
  609.         {
  610.                 winDecor[numberOfDecorations++] = AtomClose;
  611.  
  612.                 /*
  613.                 ** If the close button is specified, the header must be
  614.                 ** specified. If the header bit is not set, set it.
  615.                 */
  616.                 if (!(decorationMask & OLWM_Header))
  617.                         winDecor[numberOfDecorations++] = AtomHeader;
  618.         }
  619.  
  620.         XChangeProperty(XtDisplay(shell),
  621.                         win,
  622.                         AtomDecor,
  623.                         XA_ATOM,
  624.                         32,
  625.                         PropModeReplace,
  626.                         (unsigned char*)winDecor,
  627.                         numberOfDecorations);
  628. }
  629.  
  630.  
  631. /*
  632. ** Example of use of AddOLWMDialogFrame, with a bit of extra stuff
  633. */
  634. void register_dialog_to_WM(Widget shell, XtCallbackProc Cbk_func)
  635. {
  636.         Atom atom;
  637.  
  638.         /*
  639.         ** Alias the "Close" item in system menu attached to dialog shell
  640.         ** to the activate callback of "Exit" in the menubar
  641.         */
  642.         if (Cbk_func)
  643.         {
  644.             atom = XmInternAtom(XtDisplay(shell),"WM_DELETE_WINDOW",TRUE);
  645.             XmAddWMProtocolCallback(shell,atom, Cbk_func,NULL);
  646.         }
  647.  
  648.         /*
  649.         ** If Motif is the window manager, skip OpenLook specific stuff
  650.         */
  651.         if (XmIsMotifWMRunning(shell)) return;
  652.  
  653.         /*
  654.         ** Register dialog shell to OpenLook.
  655.         **
  656.         ** WARNING: on some systems, adding the "Close" button allows the title
  657.         ** to be properly centered in the title bar. On others, activating
  658.         ** "Close" crashes OpenLook. The reason is not clear yet, but it seems
  659.         ** the first case occurs with OpenWindows 2 while the second occurs with
  660.         ** Openwindows 3. Thus, comment out one of the two following lines as
  661.         ** suitable for your site, and send e-mail to syj@ecmwf.co.uk if you
  662.         ** find out what is going on !
  663.         */
  664.         AddOLWMDialogFrame(shell,(OLWM_Header | OLWM_Resize));
  665. /*      AddOLWMDialogFrame(shell,(OLWM_Header | OLWM_Resize | OLWM_Close)); */
  666. }
  667.  
  668.  
  669. -----------------------------------------------------------------------------
  670. Subject: 127) Why does an augment translation appear to act as replace for
  671. some widgets?  When I use either augment or override translations in
  672. .Xdefaults it seems to act as replace in both Motif 1.0 and 1.1
  673.  
  674. Answer: By default, the translation table is NULL.  If there is nothing
  675. specified (either in resource file, or in args), the widget's Initialize
  676. finds: Oh, there is NULL in translations, lets use our default ones.  If,
  677. however, the translations have become non-NULL, the default translations are
  678. NOT used at all. Thus, using #augment, #override or a new table has identical
  679. effect: defines the new translations. The only way you can augment/override
  680. Motif's default translations is AFTER Initialize, using XtSetValues.  Note,
  681. however, that Motif managers do play with translation tables as well ... so
  682. that results are not always easy to predict.
  683.  
  684. From OSF: A number of people have complained about not being able to
  685. augment/override translations from the .Xdefaults.  This is due to the
  686. complexity of the menu system/keyboard traversal and the necessary
  687. translations changes required to support the Motif Style Guide in menus.  It
  688. cannot be fixed in a simple way. Fixing it requires re-design of the
  689. menus/buttons and it is planned to be fixed in 1.2.
  690.  
  691.  
  692.  
  693.  
  694.  
  695. -----------------------------------------------------------------------------
  696. Subject: 128) How do you "grey" out a widget so that it cannot be activated?
  697.  
  698. Answer: Use XtSetSensitive(widget, False). Do not set the XmNsensitive
  699. resource directly yourself (by XtSetValues) since the widget may need to talk
  700. to parents first.
  701.  
  702.  
  703. -----------------------------------------------------------------------------
  704. Subject: 129) Why doesn't the Help callback work on some widgets?
  705.